package org.nhindirect.stagent;

import java.util.ArrayList;
import java.util.Collection;

public class ObjectCollection<T> extends ArrayList<T> 
{
    public ObjectCollection()
    {
    }
    
    public ObjectCollection(Collection<T> items)
    {
        this.addAll(items);
    }
    
    public void add(Collection<T> items)
    {
        if (items == null)
        {
            throw new IllegalArgumentException();
        }
        
        this.addAll(items);
    }
        
    protected void insertItem(int index, T item)
    {
        if (item == null)
        {
            throw new IllegalArgumentException();
        }
        
        this.add(index, item);
    }

    protected void setItem(int index, T item)
    {
        if (item == null)
        {
            throw new IllegalArgumentException();
        }
        
        this.remove(index);
        this.add(index, item);
    }        

}
